﻿using Eleven.BreakAway.Model;
using System.Data.Entity.ModelConfiguration;

namespace Eleven.BreakAway.DataAccess
{
    class LodgingConfiguration : EntityTypeConfiguration<Lodging>
    {
        public LodgingConfiguration()
        {
            Property(l => l.Name).IsRequired().HasMaxLength(200);
            Property(l => l.MilesFromNearestAirport).HasPrecision(8, 1);

            HasOptional(l => l.PrimaryContract).WithMany(p => p.PrimaryContractFor);
            HasOptional(l => l.SecondaryContract).WithMany(p => p.SeconaryContractFor);

            //HasRequired(l => l.Destination).WithMany(d => d.Lodgings).WillCascadeOnDelete(false);
        }
    }
}
